package com.nelson.musicplayer.business.splash

import android.content.Intent
import android.view.View
import androidx.core.view.ViewCompat
import androidx.core.view.ViewPropertyAnimatorListener
import com.nelson.musicplayer.R
import com.nelson.musicplayer.base.BaseActivity
import com.nelson.musicplayer.MainActivity
import com.nelson.musicplayer.databinding.ActivitySplashBinding

class SplashActivity : BaseActivity<ActivitySplashBinding>(), ViewPropertyAnimatorListener {
    override fun getContentView(): Int = R.layout.activity_splash

    override fun initData() {
        ViewCompat.animate(mViewDataBinding.icon)
            .scaleX(1.1f)
            .scaleY(1.1f)
            .setListener(this)
            .setDuration(2000).start()
    }

    override fun onAnimationEnd(view: View?) {
        var intent = Intent(this, MainActivity::class.java);
        startActivity(intent)
        finish()
    }

    override fun onAnimationCancel(view: View?) {
    }

    override fun onAnimationStart(view: View?) {
    }

}
